/*
 * The code in the following example updates one of the out_of_date
 * drawings in the current part.
*/
#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_draw.h>
#include <uf_draw_types.h>
#include <uf_obj.h>
#include <uf_view.h>
void ufusr(char *param, int *retcod, int param_len)
{
    int           ifail = 0;
    char          drawing_name[30] = "";
    char          view_name [30] = "";
    char          error_message[133];
    tag_t         view_tag = NULL_TAG;
    tag_t         drawing_tag;
    logical       out_of_date;
    ifail = UF_initialize();
    if (!ifail)
    {
        /* get the name of the first drawing */
        ifail = uc6497(drawing_name);
    }
    if (!ifail)
    {
        /* Get the tag of the drawing */
      ifail =uc5028(drawing_name,strlen(drawing_name),&drawing_tag);
    }
    if (!ifail)
    {
        /* get the name of the drawing's first view. */
        ifail = uc6499 (drawing_name, view_name);
    }
    if (!ifail)
    {
        /* Get the view's tag. */
        ifail = UF_VIEW_ask_tag_of_view_name (view_name,
                &view_tag);
    }
    if (!ifail)
    {
       /* Query the drawing's out of date status. */
        ifail = UF_DRAW_is_object_out_of_date(drawing_tag,
                &out_of_date);
    }
    if (out_of_date)
    {
       /* Update the view. */
        ifail = UF_DRAW_update_one_view(drawing_tag,view_tag);
     }
    printf ("UF_DRAW_update_one_view sample ");

    if (ifail)
    {
        ifail = UF_get_fail_message( ifail, error_message );
        printf( "fails.\nError is: %s\n", error_message );
    }
    else
        printf( "is successful.\n" );
    UF_terminate();
}

